#include "Engine.h"

Engine::Engine(Model *customModel):
model(customModel), controller(NULL), view(NULL)
{
	controller = new Controller(model);
	view = new View(model, controller);
	Tracer::initTracer();
	model->data = load_datafile("data/gfx.dat");
	//model->parseDataFile("data/gfx.dat");
}

Engine::~Engine(void)
{
}

void Engine::addGameState(GameState state)
{
	controller->addGameState(state);
}

void Engine::addGameRoutine(GameRoutine *routine)
{
	routine->controller = controller;
	//routine->model = model;
	routine->addModel(model);
	routine->view = view;
	controller->addGameRoutine(routine);
}

void Engine::initializeGame()
{
	install_keyboard();
	install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, "");
	controller->initialize();
}
